package com.mustafaiev.tair.autobase.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.mustafaiev.tair.autobase.db.DBConnector;
import com.mustafaiev.tair.autobase.worker.Worker;

/**
 * Data Access Object for autobase workers
 * 
 * @author Tair Mustafaiev
 * 
 */
public interface WorkerDao {

	/**
	 * Method creates a new autobase worker
	 * 
	 * @return int
	 * @throws SQLException
	 */
	boolean addNewWorker(Worker worker) throws SQLException;

	/**
	 * Method gets information about worker
	 * 
	 * @param worker
	 * @return {@link ResultSet}
	 * @throws SQLException
	 */
	ResultSet getWorkerInformation(Worker worker) throws SQLException;

	/**
	 * Method gets all workers  
	 * 
	 * @return {@link ResultSet} of autobase workers
	 * @throws SQLException
	 */
	List<Worker> getAllWorkers() throws SQLException;
	
	
	/**
	 * 
	 * Method gets all drivers 
	 * 
	 * @return {@link List} of drivers
	 * @throws SQLException
	 */
	List<Worker> getDrivers() throws SQLException;

	/**
	 * @param worker
	 * @return int
	 * @throws SQLException
	 */
	int updateWorkerInformation(Worker worker) throws SQLException;

	/**
	 * Method checks existing worker in database with such email, if is not
	 * exist, return false, otherwise return true.
	 * 
	 * @return int
	 * @throws SQLException
	 */
	boolean checkWorkerByEmail(Worker worker) throws SQLException;

	/**
	 * Method check workers by email address and password. It's needed for authorization
	 * 
	 * @param worker
	 * @return
	 * @throws SQLException
	 */
	boolean checkWorkerByEmailAndPassword(Worker worker) throws SQLException;

	/**
	 * @param worker
	 * @return int
	 * @throws SQLException
	 */
	int deleteWorker(Worker worker) throws SQLException;

	/**
	 * Block worker needed for unset worker rights
	 * 
	 * @param worker
	 * @return
	 * @throws SQLException
	 */
	int blockWorker(Worker worker) throws SQLException;

	/**
	 * Unblock worker needed for set worker rights
	 * 
	 * @param worker
	 * @return
	 * @throws SQLException
	 */
	int unblockWorker(Worker worker) throws SQLException;
	
	/**
	 * Setter vethod for connector class
	 * 
	 * @param connector
	 */
	void setConnector(DBConnector connector);

}
